home *** CD-ROM | disk | FTP | other *** search
-
- Greetings!
-
- SRCH (a shortened version of SEARCH) is a little program I wrote a few
- years back that has slowly become a sort of company standard where I work.
- For network administrators, it's a must-have.
-
- I had originally planned to sell SRCH as shareware, and later decided that
- the world has enough dinky little programs selling for a nickel, and
- supported by those that don't have time for support. SRCH is freeware;
- please pass a copy to anyone you feel can handle it. Likewise, excuse the
- haphazard format of this doc; it looks like it was thrown together in a
- night...because it was. What do you want for free?
-
- GREAT STUFF SRCH CAN DO FOR NETWORK ADMINISTRATORS & POWER USERS
- ----------------------------------------------------------------
- - Report total disk usage by subdirectory tree (for user home dir's)
- - Locate lost files in a huge tree quickly, using multiple wild card spec's
- - Copy or remove entire directory trees from the command line
- - Search and destroy zero-byte files, outdated files, etc.
- - Hate to say this, but "and much more!"
- Really, you gotta read this whole thing to understand.
-
- POSSIBLY DANGEROUS STUFF SRCH CAN DO
- ------------------------------------
- Please, please, please, read this entire document before you attempt to
- use the /RM and /RT options. SRCH can and will destroy entire subdirectory
- trees...it was written for people who hate "Are you sure?" prompts, so it
- has none. It'll kill system files, read-only files, it doesn't care.
- You're holding a loaded gun...make sure you know how to use it. Thing is,
- many net admin's wish they had loaded guns nowadays <grin>.
-
-
-
- HOW DOES SRCH WORK?
- -------------------
- In short, it works by using a set of "filters" to select a particular set of
- files, then applies any one or more of the "actions" on those files. So you
- just give it a path to start in (it's recursive by default, though you can
- specify non-recursive mode), an optional filter or filters, and an optional
- action. If you give it no action, it just prints the filenames that it
- found meeting the filter conditions specified.
-
- It's actually easiest to understand through examples:
-
- SRCH
- displays all filenames in the current dir and all subdir's
-
- SRCH D:\
- displays all filenames on the entire D: drive
-
- SRCH F:\ /n *.bat
- name search: displays names of all batch files on F: drive
-
- SRCH F:\ /n *.exe,*.com,*.bat
- name search: displays all program files on the F: drive
-
- SRCH F:\UTILS /!n *.exe,*.com,*.bat
- not name search: displays all non-program files in my UTILS directory.
-
- SRCH F:\UTILS /n *.exe,*.com,*.bat /!n a*.*,b*.*,c*.*
- displays all program files in UTILS that don't start with A, B, or C.
-
- SRCH F:\DOCS /n *.bak /ag 3
- displays all backup files in my DOCS directory that are >3 days old
- (/ag is Age Greater; there's also an Age Less and Age Equal)
-
- SRCH F:\DOCS /al 1
- displays all files in DOCS directory that were created today.
- (Age Less than one day)
-
- SRCH F:\COMMON /sg 500000
- displays all backup filenames in \COMMON with a Size Greater than 500000
- (there's also a Size Less and Size Equal)
-
- SRCH F:\ /se 0 /rm
- Locate all zero-byte files on my entire F: drive and remove them.
- WARNING: the /rm option assumes that you mean it! As long as you have
- network permissions (if applicable) to remove those files, they will be
- removed, regardless of file attributes: INCLUDING system files in root of
- your boot drive! Beginning users are advised to first execute the SRCH with
- no /rm option, examine the resulting list of files that are to be affected,
- and then re-execute the same command with /rm.
-
- SRCH F:\OLDFILES /rt
- Remove tree: the \OLDFILES directory, and all subdir's, are removed.
- NOTE: the warning above for /rm option applies for /rt as well.
-
- SRCH F:\OLDFILES /rt /q
- Quiet option: same as above, but don't display filenames as you delete them.
-
- SRCH F:\HOME /t
- Display only the Total number of files, dir's, and bytes occupied in the
- directories under \HOME.
-
- SRCH F:\HOME /td
- Display Totals by Directory for all of the subdir's under \HOME
- Rough example:
- \HOME\SCOTT 128 files 3051k 421k (82%)
- \HOME\SCOTT\DOCS 12 files 112k 128k (96%)
- \HOME\SCOTT\C 0 files 0k 0k (100%)
- \HOME\SCOTT\C\SRC 217 files 243k 292k (92%)
- etc
-
- The first file size is the actual number of data bytes in the files, the
- second is actual disk space consumed (taking cluster slop into account), and
- the percentage is the percentage of #1 over #2 (note that I don't have a
- calculator handy, so I just dreamed up the numbers above).
-
- SRCH F:\HOME /td1
- Display totals by directory, only one level deep (you can specify any
- number), adding up everything underneath...this is REAL nice for doing the
- following on a network:
- \HOME\MICKEY 551 files: 12728k 14184k (89%)
- \HOME\SCOTT 21 files: 997k 1056k (94%)
- \HOME\BOB 50 files: 3588k 3719k (96%)
- \HOME\JERRY 112 files: 1651k 1888k (87%)
- \HOME\PHIL 462 files: 6439k 7467k (86%)
-
- Now we know who the disk pigs are.
-
-
- Let's get to a couple tricky ones...
-
- SRCH F:\HOME\SCOTT\EXPORT /c F:\HOME\JERRY\IMPORT
- Copy Scott's export directory to Jerry's import directory, with the entire
- subdirectory tree intact. In other words, as the source directories are
- recursed, the destination directories are created to mirror those on the
- source.
-
- SRCH F:\HOME\SCOTT\EXPORT /f F:\HOME\JERRY\IMPORT
- Flat file copy: copy all files under Scott's export tree over to Jerry's
- import directory, but don't create any subdir's on Jerry's side.
- The "flat" means that even though the source may be a tree several levels
- deep, the destination directory is never changed...meaning that all of
- the files from the source are copied into a single directory on the
- destination drive. Note that this has strange consequences when there
- exist many files on the source with the same name.
-
- SRCH F:\HOME\SCOTT\EXPORT /nr /c F:\HOME\JERRY\IMPORT
- Non-recursive copy: this command is equivalent to
- COPY \HOME\SCOTT\EXPORT\*.* \HOME\JERRY\IMPORT
- In other words, recursion on the source directory is turned off; SRCH only
- acts on the files in the top directory specified as the source.
-
- SRCH C:\MYDOCS /b F:\HOME\SCOTT\HDBACKUP
- Backup (copy files that have archive bit set, reset archive bit) my
- documents on my C: drive into a directory on my F: drive.
-
- SRCH C:\MYDOCS /?a /c F:\HOME\SCOTT\HDBACKUP /-a
- This command uses a SRCH by file attribute (archive bit, in this case) to do
- exactly the same as the previous example. Note you can also SRCH for files
- that DON'T have a particular attribute set, and you can manipulate them as
- well.
-
-
- There's more, but I'm tired of typing and you're tired of reading. Here's a
- grand finale (make things real ugly)
-
- SRCH C:\ /nr /?h!a /!n *.sys /ag 30 /c F:\BADFILES /rm
- Locate files in root of C: (not subdir's) that are hidden but have archive
- bit cleared, don't have a .SYS extension, and are more than a month old.
- Copy those to a dir on F: and then remove the ones on C:. <gasp, pant pant>
-
-
- FUTURE PLANS FOR SRCH (AND KNOWN PROBLEMS TO FIX!)
- --------------------------------------------------
- SRCH has a few drawbacks that I'll fix when I have the time. I'm in the
- process of rewriting it entirely, and expect that the next release will be
- v2.0. I need some feedback and/or encouragement, though. Send me your
- thoughts, good or bad!
-
- The biggest problem now is that SRCH's return values are nearly worthless.
- Batch file use is limited because you can't tell if an operation succeeded
- or not using error levels. That will be fixed.
-
- Often SRCH output scrolls forever, and the user has to pipe the output into
- MORE to be able to read it. I plan to add a /P option to PAUSE the output
- after each screenful...and do it right whether you're in 25, 43, or 50, or
- whatever line mode.
-
- When you pass a non-existent directory name to SRCH, you get "No matching
- files found", just like the dir did exist and there really were no files
- there. Later versions will instead report "directory does not exist", to
- avoid disasters caused by typing errors.
-
- Some people have really wiped themselves out by accidentally removing the
- system files (and all else) from their boot disk with a typing error.
- Some have suggested that /RM prompt for verification of deletion of each
- file, with /RM! to delete no matter what (same for /RT and /RT!). I'm
- waiting for more input before I decide to do this...it's contrary to what
- I wrote it for. In fact, /RM used to be just /R until I realized how
- close that was to /F and /T on the keyboard.
-
- I'd like to add a /M for MOVE option, that will remove the source file
- only if it was successfully copied to the destination tree. Today, the
- copy and remove functions are totally separate, which could be dangerous
- if you run out of space on the destination drive before the copy is
- completed... the /RM continues even after the /C fails.
-
- Last, I want to add a rather confusing filter that is based on the
- existence of a file on the destination drive. In other words, to copy
- only those files that already exist on the destination (in effect updating
- a directory) you'd type SRCH C:\NEWVER /E /C D:\OUTDATED. You could also
- use this filter with a negation to remove any files in one tree that didn't
- exist on a source (this is handy where a tree is regularly updated with
- SRCH, but sometimes files are deleted on the source and left lying around
- on the destination)...
-
- SRCH C:\SRC /C D:\DEST copy all files into existing DEST directory
- SRCH D:\DEST /!E C:\SRC /RM then remove those in DEST that aren't on SOURCE
-
-
-
- CONTACTING ME
- -------------
- I love hearing comments about my programs, which are always distributed as
- freeware (so far, anyways). What I don't like is getting telephone calls in
- the middle of the night when my kids are in bed. Please, direct your messages
- via eMail (preferred: as of this writing I'm on CompuServe nearly every day)
- or US Mail. Comments welcomed when addressed to:
-
- Scott Wertz CompuServe: 71541,3051
- 9740 Michael Drive MHS Mail: SW @ RRC
- Streetsboro, OH 44241
-
-